#ifndef _RTX_EVAL_

#include "test_processes.h"
#include "rtx.h"
#include "debug.h"
#include "processes.h"
#include "proctables.h"

VOID setTestInfo() {
	RTX_PROCS[NULL_PROCESS].pid = NULL_PROCESS;
	RTX_PROCS[NULL_PROCESS].priority = 5;
	RTX_PROCS[NULL_PROCESS].stacksize = 4096;
	RTX_PROCS[NULL_PROCESS].rtx_proc_entry = null_process;

	RTX_PROCS[TEST_PROCESS_1].pid = TEST_PROCESS_1;
	RTX_PROCS[TEST_PROCESS_1].priority = 0;
	RTX_PROCS[TEST_PROCESS_1].stacksize = 4096;
	RTX_PROCS[TEST_PROCESS_1].rtx_proc_entry = process_1_code;

	RTX_PROCS[TEST_PROCESS_2].pid = TEST_PROCESS_2;
	RTX_PROCS[TEST_PROCESS_2].priority = 1;
	RTX_PROCS[TEST_PROCESS_2].stacksize = 4096;
	RTX_PROCS[TEST_PROCESS_2].rtx_proc_entry = process_2_code;
}

VOID process_1_code() {
	int counter = 0;
	while(TRUE)
	{
		debug_out_string("In Process 1");
		debug_out_int(counter);
		debug_out_string("\n\r");
		void* mem = request_memory_block();

		delayed_send(TEST_PROCESS_1, mem, 1000);

		int sender = 0;
		mem = receive_message(&sender);

		release_memory_block(mem);
		counter++;
	}
}

VOID process_2_code () {
	char c = 0;
	while(TRUE)
	{
		//debug_out_string("In Process 2");

		int sender = 0;
		int* msg = receive_message(&sender);

		c = *(msg + 64);
		debug_out_char(c);

		send_message(UART_I_PROCESS, msg);

		//release_memory_block(msg);
	}
}

VOID null_process (VOID)
{
	while(1)
	{
		release_processor();
	}
}

#endif
